package com.cetccloud.ap.util.trace;

import com.cetccloud.ap.util.ResultEnum;
import lombok.Data;

@Data
public class Trace {

    /**
     * 返回码(200:成功; 非200:失败)
     **/
    private Integer code;

    /**
     * 成功返回“成功”，失败返回对应的失败信息
     **/
    private String msg;

    public static Trace success() {
        Trace trace = new Trace();
        trace.setCode(ResultEnum.SUCCESS.getCode());
        trace.setMsg(ResultEnum.SUCCESS.getMsg());
        return trace;
    }

    public static Trace error() {
        Trace trace = new Trace();
        trace.setCode(ResultEnum.ERROR.getCode());
        trace.setMsg(ResultEnum.ERROR.getMsg());
        return trace;
    }

    public static Trace error(String msg) {
        Trace trace = new Trace();
        trace.setCode(ResultEnum.ERROR.getCode());
        trace.setMsg(msg);
        return trace;
    }
}
